<template>
	<uv-parse 
	:content="content" 
	:selectable="selectable"
	:containerStyle="containerStyle"
	:copyLink="copyLink"
	:domain="domain"
	:errorImg="errorImg"
	:lazyLoad="lazyLoad"
	:pauseVideo="pauseVideo"
	:previewImg="previewImg"
	:setTitle="setTitle"
	:scrollTable="scrollTable"
	:showImgMenu="showImgMenu"
	:tagStyle="tagStyle"
	:useAnchor="useAnchor"
	></uv-parse>
</template>

<script setup>
	import sheep from "@/sheep"
	import { watch } from "vue";
	const props = defineProps({
		containerStyle: {
			type: String,
			default: ''
		},
		data: {
			type: String,
			default: ''
		},
		copyLink: {
			type: [Boolean, String],
			default: true
		},
		domain: String,
		errorImg: {
			type: String,
			default: ''
		},
		lazyLoad: {
			type: [Boolean, String],
			default: false
		},
		loadingImg: {
			type: String,
			default: ''
		},
		pauseVideo: {
			type: [Boolean, String],
			default: true
		},
		previewImg: {
			type: [Boolean, String],
			default: true
		},
		scrollTable: [Boolean, String],
		selectable: [Boolean, String],
		setTitle: {
			type: [Boolean, String],
			default: true
		},
		showImgMenu: {
			type: [Boolean, String],
			default: true
		},
		isProtocol:{  //是否是协议
			type: Boolean,
			default: false
		},
		protocolKey:{  //协议的Key
			type: String,
			default: ''
		},
		tagStyle: Object,
		useAnchor: [Boolean, Number]
	})
	const state = reactive({
		content:''
	})
	const configInfo = computed(() => {
		return sheep.$store('app').configInfo
	})
	const content = computed(() => {
		if(props.isProtocol) return state.content
		return props.data
	})
	const emit = defineEmits(['info'])
	watch(() => props.protocolKey, async (value) => {
		if(!value) return
		state.content = configInfo.value[value]
		// if(value && props.isProtocol) {
		// 	const { content,title } = await sheep.$store('app').getRichtext(props.protocolKey)
		// 	state.content = content
		// 	emit('info',{title,content})
		// }
	},{immediate:true})
</script>

<style>

</style>